#ifndef CHITU_MATH_H__
#define CHITU_MATH_H__

/*
    这个文件是赤兔模块的数学部分
*/

#include "chitu_base.h"
#include <math.h>
#include <time.h>
#include <limits.h>
#include <float.h>

//随机数部分
void chitu_srand(uint64_t x);
uint64_t chitu_rand();
double chitu_random();
uint64_t chitu_randint(int64_t start, int64_t end);
double chitu_randfloat(double start, double end);

//通用数学部分
double chitu_squre(double x);
double chitu_sqrt(double x);
double chitu_cube(double x);
double chitu_cbrt(double x);
double chitu_pow(double x, double n);

//array部分
double chitu_array_sum(chitu_array *a);
double chitu_array_even(chitu_array *a);
double chitu_array_variance(chitu_array *a);
double chitu_array_standard_deviation(chitu_array *a);

void chitu_array_max(chitu_array *a, double *result);
void chitu_array_min(chitu_array *a, double *result);
void chitu_array_sort(chitu_array *a);
void chitu_array_reverse(chitu_array *a);

//随机
void chitu_array_random(chitu_array *a);
void chitu_array_randint(chitu_array *a, int64_t start, int64_t end);
void chitu_array_randfloat(chitu_array *a, double start, double end);
double chitu_array_choice(chitu_array *a);

//四则运算
    //对单个数字运算
void chitu_array_plus(chitu_array *a, double n);
void chitu_array_minus(chitu_array *a, double n);
void chitu_array_mutiplys(chitu_array *a, double n);
void chitu_array_divide(chitu_array *a, double n);
void chitu_array_mod(chitu_array *a, double n);
    //对数组运算
void chitu_array_plusa(chitu_array *a, chitu_array *b);
void chitu_array_minusa(chitu_array *a, chitu_array *b);
void chitu_array_mutiplysa(chitu_array *a, chitu_array *b);
void chitu_array_dividea(chitu_array *a, chitu_array *b);
void chitu_array_moda(chitu_array *a, chitu_array *b);

//指数运算
void chitu_array_squre(chitu_array *a);
void chitu_array_sqrt(chitu_array *a);
void chitu_array_cube(chitu_array *a);
void chitu_array_cbrt(chitu_array *a);
void chitu_array_pow(chitu_array *a, double n);

#endif